package com.xgst.bmg.server.handlers;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @Author: xgstjs-11
 * @CreateTime: 2021-03-09 14:34:03
 * @Description:
 */
public class ConnectionAdapter extends ChannelInboundHandlerAdapter {

	private static final Logger log = LoggerFactory.getLogger(ConnectionAdapter.class);
	@Override
	public void channelActive(ChannelHandlerContext ctx) throws Exception {

		log.info("channel active:" + ctx.channel().remoteAddress());
		
	}

	@Override
	public void channelInactive(ChannelHandlerContext ctx) throws Exception {

		log.info("channel inactive:" + ctx.channel().remoteAddress());
		ctx.fireChannelInactive();
	}

	@Override
	public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {

		log.error("channel exceptionCaught:" + ctx.channel().remoteAddress(), cause);

	}

}
